package com.lian.aieduc.mapper;

import com.lian.aieduc.model.po.User;
import com.lian.aieduc.model.vo.UserVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UsersMapper {


    /**
     * 新增用户
     *
     * @param user
     */
    @Insert(
        "insert into user (nickname, password, phone_code,email) values (#{nickname},#{password},#{phoneCode}," +
        "#{email})")
    void insertUser(User user);







    @Select("select * from user where  phone_code = #{phoneNumber}")
    User findUserByPhone(String phoneNumber);


    @Select("select * from user where email = #{email}")
    User findUserByEmail(String email);

    @Select("select nickname,avatar_url,intro,real_name,email,phone_code,qq_code,gender from user where id = #{userId}")
    UserVO getUserInfoById(Long userId);

    void updateUserById(User user);
}
